package com.gln.bloger.pojos;

import java.util.Date;

import com.gln.bloger.util.PojoUtil;

public class Website extends Entity {
public static final long serialVersionUID = 206437645033737127L;
    
    // Simple properties
    private String  id               = null;
    private String  handle           = null;
    private String  name             = null;
    private String  subName          = null;
    private String  description      = null;
    private Boolean enabled          = Boolean.TRUE;
    private Date    dateCreated      = new java.util.Date();
    private Date    lastModified     = new Date();
    private String ignoreWords = null;
    private int summaryLimitLength;
    private String theme;
    // Associated objects
    private User           creator = null; 
    
    public Website() {
    }

    public String getId() {
        return this.id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    
    public String getHandle() {
        return this.handle;
    }
    
    public void setHandle(String handle) {
        this.handle = handle;
    }
    
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public User getCreator() {
        return creator;
    }

    public void setCreator( User ud ) {
        creator = ud;
    }

    public Date getDateCreated() {
        if (dateCreated == null) {
            return null;
        } else {
            return (Date)dateCreated.clone();
        }
    }

    public void setDateCreated(final Date date) {
        if (date != null) {
            dateCreated = (Date)date.clone();
        } else {
            dateCreated = null;
        }
    }
    

    
    public String toString() {
        StringBuffer str = new StringBuffer("{");
        
        str.append("id=" + id + " " + "name=" + name + " " + "description=" +
                description + " "+" handle=" + " "+handle);
        str.append('}');
        return (str.toString());
    }
    
    public boolean equals(Object pOther) {
        if (pOther instanceof Website) {
            Website lTest = (Website) pOther;
            boolean lEquals = true;
            lEquals = PojoUtil.equals(lEquals, this.getId(), lTest.getId());
            lEquals = PojoUtil.equals(lEquals, this.getName(), lTest.getName());
            lEquals = PojoUtil.equals(lEquals, this.getHandle(), lTest.getHandle());
            lEquals = PojoUtil.equals(lEquals, this.getDescription(), lTest.getDescription());
            lEquals = PojoUtil.equals(lEquals, this.getCreator(), lTest.getCreator());
            return lEquals;
        } else {
            return false;
        }
    }
    
    public int hashCode() {
       return super.hashCode();
    }
    
    /**
     * Setter is needed in RollerImpl.storePersistentObject()
     */
    public void setData(Entity otherData) {
        Website other = (Website)otherData;
        
        this.id = other.getId();
        this.name = other.getName();
        this.handle = other.getHandle();
        this.description = other.getDescription();
        this.creator = other.getCreator();
       
        this.enabled = other.getEnabled();
        this.dateCreated = other.getDateCreated();
        this.lastModified = other.getLastModified();
    }
    
   
   
    public void setAdminUserCount(int adminUserCount) {
        // no-op
    }
    
    public Boolean getEnabled() {
        return this.enabled;
    }
    
   
    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }
    
    public Date getLastModified() {
        return lastModified;
    }

    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }

	public String getIgnoreWords() {
		return ignoreWords;
	}

	public void setIgnoreWords(String ignoreWords) {
		this.ignoreWords = ignoreWords;
	}
	
	public int getSummaryLimitLength() {
		return summaryLimitLength;
	}

	public void setSummaryLimitLength(int summaryLimitLength) {
		this.summaryLimitLength = summaryLimitLength;
	}

	public String getSubName() {
		return subName;
	}

	public void setSubName(String subName) {
		this.subName = subName;
	}

	public String getTheme() {
		return theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}
}